package com.juzipi.framework.web.exception;

import com.juzipi.common.constant.json.ResultCode;
import com.juzipi.common.exception.BaseException;
import com.juzipi.common.tools.Result;
import com.juzipi.common.tools.ResultTool;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
public class GlobExceptionHandler {

    /**
     * 基础异常捕捉
     * @param e 异常返回的信息
     * @return Result JSON结果集
     */
    @ExceptionHandler(BaseException.class)
    public Result baseException(BaseException e){
        return ResultTool.failCustomize(ResultCode.FAIL,e.getMessage());
    }


}
